/**
 * 
 */
package com.swim.phonenumprivacy.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jeesite.common.config.Global;
import com.jeesite.common.entity.Page;
import com.jeesite.common.web.BaseController;
import com.swim.phonenumprivacy.entity.NatatoriumCallInfo;
import com.swim.phonenumprivacy.service.NatatoriumCallInfoService;

/**
 * 游泳馆隐私号码呼叫记录Controller
 * @author ljw
 * @version 2024-01-14
 */
@Controller
@RequestMapping(value = "${adminPath}/phonenumprivacy/natatoriumCallInfo")
public class NatatoriumCallInfoController extends BaseController {

	@Autowired
	private NatatoriumCallInfoService natatoriumCallInfoService;
	
	/**
	 * 获取数据
	 */
	@ModelAttribute
	public NatatoriumCallInfo get(String id, boolean isNewRecord) {
		return natatoriumCallInfoService.get(id, isNewRecord);
	}
	
	/**
	 * 查询列表（单个游泳馆）
	 */
	@RequiresPermissions("phonenumprivacy:natatoriumCallInfo:view")
	@RequestMapping(value = {"list", ""})
	public String list(NatatoriumCallInfo natatoriumCallInfo, Model model) {
		model.addAttribute("natatoriumCallInfo", natatoriumCallInfo);
		return "swim/phonenumprivacy/natatoriumCallInfoListOne";
	}
	
	/**
	 * 查询列表（多个游泳馆）
	 */
	@RequiresPermissions("phonenumprivacy:natatoriumCallInfo:view")
	@RequestMapping(value = {"moreNatatoriumList", ""})
	public String moreNatatoriumList(NatatoriumCallInfo natatoriumCallInfo, Model model) {
		model.addAttribute("natatoriumCallInfo", natatoriumCallInfo);
		return "swim/phonenumprivacy/natatoriumCallInfoListMore";
	}
	
	/**
	 * 查询列表数据
	 */
	@RequiresPermissions("phonenumprivacy:natatoriumCallInfo:view")
	@RequestMapping(value = "listData")
	@ResponseBody
	public Page<NatatoriumCallInfo> listData(NatatoriumCallInfo natatoriumCallInfo, HttpServletRequest request, HttpServletResponse response) {
		Page<NatatoriumCallInfo> page = natatoriumCallInfoService.findPage(new Page<NatatoriumCallInfo>(request, response), natatoriumCallInfo); 
		return page;
	}

	/**
	 * 查看编辑表单
	 */
	@RequiresPermissions("phonenumprivacy:natatoriumCallInfo:view")
	@RequestMapping(value = "form")
	public String form(NatatoriumCallInfo natatoriumCallInfo, Model model) {
		model.addAttribute("natatoriumCallInfo", natatoriumCallInfo);
		return "swim/phonenumprivacy/natatoriumCallInfoForm";
	}

	/**
	 * 保存游泳馆隐私号码呼叫记录
	 */
	@RequiresPermissions("phonenumprivacy:natatoriumCallInfo:edit")
	@PostMapping(value = "save")
	@ResponseBody
	public String save(@Validated NatatoriumCallInfo natatoriumCallInfo) {
		natatoriumCallInfoService.save(natatoriumCallInfo);
		return renderResult(Global.TRUE, text("保存游泳馆隐私号码呼叫记录成功！"));
	}
	
	/**
	 * 删除游泳馆隐私号码呼叫记录
	 */
	@RequiresPermissions("phonenumprivacy:natatoriumCallInfo:edit")
	@RequestMapping(value = "delete")
	@ResponseBody
	public String delete(NatatoriumCallInfo natatoriumCallInfo) {
		natatoriumCallInfoService.delete(natatoriumCallInfo);
		return renderResult(Global.TRUE, text("删除游泳馆隐私号码呼叫记录成功！"));
	}
	
}